05. Fixing Bugs
Section 4: Fix Any Bugs You Find With Your Unit Tests!
As we stated in the previous section, a failing unit test could mean one of two things:
- Your unit test is faulty.
- Something in your program isn't working.
Your task is to make sure all of the Application Requirements are properly implemented. Some requirements may not be performed and some bugs may produce unexpected behavior. After you fix any broken requirements, all of your unit tests should pass!
Application Requirements to Test:
- If alarm is armed and a sensor becomes activated, put the system into pending alarm status.
- If alarm is armed and a sensor becomes activated and the system is already pending alarm, set the alarm status to alarm on.
- If pending alarm and all sensors are inactive, return to no alarm state.
- If alarm is active, change in sensor state should not affect the alarm state.
- If a sensor is activated while already active and the system is in pending state, change it to alarm state.
- If a sensor is deactivated while already inactive, make no changes to the alarm state.
- If the camera image contains a cat while the system is armed-home, put the system into alarm status.
- If the camera image does not contain a cat, change the status to no alarm as long as the sensors are not active.
- If the system is disarmed, set the status to no alarm.
- If the system is armed, reset all sensors to inactive.
- If the system is armed-home while the camera shows a cat, set the alarm status to alarm.